<?php

/*
 * 赠送纪录视图(hs_presrent_view)
	SELECT p.*,u.`nickname` AS userName,a.`username` AS adminName
	FROM `hs_presrent` AS p
	LEFT JOIN `hs_mng_admin` AS a ON a.`id`=p.`adminID`
	LEFT JOIN `hs_user` AS u ON u.`id`=p.`userID`
 */

/** 
 * @author Administrator
 * 
 */
class Presrent_mdl extends MY_Model {
	
	/**
	 */
	public function __construct() {
		parent::__construct ();
		$this->load->database();
		$this->_table = parent::T_PRESRENT;
	}
	/**
	 * 赠送纪录
	 * @param int $adminID
	 * @param int $userID
	 * @param int $amount
	 * @return boolean
	 */
	public function record($adminID,$userID,$amount,$reason=''){
		$insert = array(
				'adminID'=>(int)$adminID,
				'userID'=>(int)$userID,
				'amount'=>(int)$amount,
				'reason'=>(string)$reason,
				'time'=>time(),
		);
		
		return $this->insert($insert);
	}
	
	
}

